import java.util.Arrays;
import java.util.Random;

public class BinaryOperation_0 {
    static int ovArr[] = new int[50];
    static int answerArr[] = new int[50];
    public static void main(String[] args) {
        printHeader();
        generateEquetions();
        prinExercise();
        printCalculations();
    }
//    打印头部说明
    static void printHeader(){
        System.out.println("----------------------------------\n-程序输出50道100以内的加减法算式的习题-\n----------------------------------");
    }
//    随机生成加减法
    static void generateEquetions(){
        int ov;
        Random random = new Random();
        for (int i = 0; i < 50; i++) {
            ov = random.nextInt(2);
            ovArr[i] = ov;
        }
    // System.out.println(Arrays.toString(ovArr));
    }
//    打印算式
    static void prinExercise(){
        int m=0,n=0;
        Random random = new Random();
        for(int i = 0;i<50;i++) {
            m = random.nextInt(101);
            n = random.nextInt(101);
            if (ovArr[i] == 1) {
                answerArr[i] = m+n;
            } else {
                answerArr[i] = m-n;
            }
            System.out.println(i + 1 + ": " + m + (1==ovArr[i]?"+":"-") + n + "= ");
        }
    }
//    打印答案
    static void printCalculations(){
        System.out.println("----------------------------------\n-下面是习题的参考答案\n----------------------------------");
        for (int i = 0; i < 50; i++) {
            System.out.println(i+1 +": "+ answerArr[i]);
        }
    }


}
